# _*_coding:utf-8 _*_
# @Time   :2020/6/24
from django.conf.urls import url
from . import clientviews
from . import adminviews
from . import robotviews
from django.urls import re_path
from django.views.static import serve
from django.conf import settings
from django.urls import path, include
from rest_framework.routers import DefaultRouter

# router = DefaultRouter()
# router.register('invcode', clientviews.InvCodeSet)  # 测试用接口
# router.register('login', views.UserCreate.as_view())  # 登录接口
# router.register('register', views.LoginView.as_view())  # 注册

urlpatterns = [
    url(r'test/', clientviews.TestView.as_view({'get': 'list'})),
    # 用户接口
    path('register', clientviews.UserCreate.as_view()),
    path('login', clientviews.LoginView.as_view()),  # /login
    path('detailinfo', clientviews.DetailInfo.as_view()),
    path('days', clientviews.Days.as_view()),
    path('chkaccount', clientviews.ChkAccount.as_view()),
    path('userdata', clientviews.UserData.as_view()),
    path('topup', clientviews.TopUp.as_view()),
    path('bindaccount', clientviews.BindAccount.as_view()),
    path('sendemail', clientviews.SendEmail.as_view()),
    path('chkemail', clientviews.ChkEmail.as_view()),
    path('havemail', clientviews.HavEmail.as_view()),
    path('havedetinfo', clientviews.HavDetInfo.as_view()),
    path('haveconfigall', clientviews.HavConfigAll.as_view()),
    path('start', clientviews.StratAuto.as_view()),
    # 管理员接口
    path('alluser', adminviews.AllUser.as_view()),
    path('allorder', adminviews.AllOrder.as_view()),
    path('codepage', adminviews.CodePage.as_view()),
    path('gencode', adminviews.GenCode.as_view()),
    path('codeinfo', adminviews.CodeInfo.as_view()),
    path('codeorderinfo', adminviews.CodeOrderInfo.as_view()),
    path('editcode', adminviews.EditCode.as_view()),
    path('delcode', adminviews.DelCode.as_view()),
    path('deluser', adminviews.DelUser.as_view()),
    path('userinfo', adminviews.UserInfo.as_view()),
    path('edituserinfo', adminviews.EditUserInfo.as_view()),
    # 机器人接口
    path('finduserbytime', robotviews.FindUsrByTime.as_view()),  # 王达亲写
    path('finishusers', robotviews.Finished.as_view()),

    # 用于访问 index.html (配置 .html 文件对应的入口路由)
    path('', clientviews.Index.as_view()),
    # 添加静态文件的路由匹配
    re_path('static/(?P<path>.*)', serve, {'document_root': settings.STATIC_ROOT}, name='static'),

]
